# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-coloredlogs
pkgname=('python2-coloredlogs' 'python-coloredlogs')
_pkgname=coloredlogs
pkgver=15.0.1
pkgrel=5
pkgdesc='Colored stream handler for the logging module.'
arch=('any')
url='https://pypi.org/project/coloredlogs/#files'
makedepends=('python2-setuptools' 'python-setuptools')
license=('MIT')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('577af26af8d27bca3f10e6aaa257245aba608cc3832985ba57bcb2b590b10bf054796a2210749c15ee1b1a17623e007e4ac3ba17bed6af95544f85f5dfafaf21')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-coloredlogs() {
  depends=('python2' 'python2-humanfriendly')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"
}

package_python-coloredlogs() {
  depends=('python' 'python-humanfriendly')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

